Fix issues for the Security Scan Workflow#51
Merged
sachinh-amazon merged 6 commits intomainfrom Oct 1, 2025
Merged
Conversation
aderende
reviewed
Oct 1, 2025
.github/workflows/security-scan.yaml
Outdated
| @@ -39,18 +39,18 @@ jobs: | |||
| if: github.event_name == 'pull_request' | |||
Contributor
There was a problem hiding this comment.
should this condition be changed if trigger were changed to from pull_request to pull_request_target?
Contributor
Author
There was a problem hiding this comment.
Nice catch! Yes it indeed needs to be changed. I will fix it.
aderende
approved these changes
Oct 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
This PR fixes the following issues in the Security Scanning workflow.
pull_requesttrigger is used for invoking a GitHub Action. This is because GitHub considers this unsafe as with thepull_requesttrigger, the GitHub Action's.yamlfile that's used to invoke the workflow is from the PR branch. The trigger has now been updated topull_request_target. Withpull_request_targetas the trigger, the GitHub Action's.yamlfile will be from the base branch of the PR. This is more secure as it doesn't allow untrusted code to invoke a workflow and will also grant access to GitHub repo secrets.mainbranch to ensure latest changes in the script are used for running the scan. After downloading, the file needs "execute" permissions. This is fixed by updating file permissions usingsudo chmod +x.1.95.xbranch for security scanning. The regex has been fixed, it will now considermainand<digit>.<digit>branches and will no longer consider*.*.xbranches as eligible for scanning.head_refas the branch name can be set by an external contributor and can be used to mount an injection attack. This is per a recommendation from CodeQL.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.